package com.itheima.chapter07.time;

import java.time.DayOfWeek;
import java.time.LocalDateTime;
import java.time.Month;

public class JDKdemo1 {
    public static void main(String[] args) {
        //创建方法
        LocalDateTime localDateTime= LocalDateTime.now();
        LocalDateTime localDateTime1= LocalDateTime.of(2027,12,25,12,13,14);
        //获取方法
        int year1 = localDateTime1.getYear();
        int year = localDateTime.getYear();
        System.out.println("当前时间年为：：："+year);
        System.out.println("指定时间年为："+year1);
        Month month = localDateTime.getMonth();
        Month month1 = localDateTime1.getMonth();
        System.out.println("当前时间月为：：："+month);
        System.out.println("指定时间月为："+month1);
        int day = localDateTime.getDayOfMonth();
        int day1 = localDateTime1.getDayOfMonth();
        System.out.println("当前时间---月份中的第"+day+"日");
        System.out.println("指定时间月份中的第"+day1+"日");
        int dayOfYear = localDateTime.getDayOfYear();
        int dayOfYear1 = localDateTime1.getDayOfYear();
        System.out.println("当前时间---一年的中的第"+dayOfYear+"日");
        System.out.println("指定时间一年的中的第"+dayOfYear1+"日");
        DayOfWeek dayOfWeek = localDateTime.getDayOfWeek();
        DayOfWeek dayOfWeek1 = localDateTime1.getDayOfWeek();
        System.out.println("当前时间星期为：：："+dayOfWeek);
        System.out.println("指定时间星期为："+dayOfWeek1);
        int minute = localDateTime.getMinute();
        int minute1 = localDateTime1.getMinute();
        System.out.println("当前时间的分钟为：：："+minute);
        System.out.println("指定时间的分钟为："+minute1);
        int hour = localDateTime.getHour();
        int hour1 = localDateTime1.getHour();
        System.out.println("当前时间的小时为：：："+hour);
        System.out.println("指定时间的小时为："+hour1);

    }
}
